﻿@{
    ViewBag.Title = "ProductForm";
    Layout = "~/Views/Shared/_Form.cshtml";

}@using LeSoft.Application.Code;
<script>
    var keyValue = request('keyValue'), organizeid = "";
    var _organizeid = "@OperatorProvider.Provider.Current().CompanyId", _Type = "", _TypeAllName = "", WIDTH = "";
    $(function () {
        initControl(); 
    })

    //初始化控件
    function initControl() {

        $("#BudgetItemId").ComboBox({
            //  url: "../../SystemManage/DataItemDetail/GetDataItemTreeJson?Encode=EnergyMeterType",
            data: [{ "key": "1", "value": "测试科目1" }, { "key": "2", "value": "测试科目2" }, { "key": "3", "value": "测试科目3" }],
            id: "key",
            text: "value",
            description: "==请选所属预算科目==",
            height: "150px"
        });

        $("#Unit").ComboBox({
            url: "../../SystemManage/DataItemDetail/GetDataItemTreeJson",
            param: { EnCode: "CalUnit" },
            description: "==选择计量单位==",
            height: "150px"
        });
        //选择物品类别
        $('#Type').ComboBoxTree({
            url: "/ResourceManage/RS_Product/GetTypeTreeJson",
            description: "==选择物品类别==",
            height: "250px",
            click: function (item) {
                _Type = item.Id;
                _TypeAllName = item.AllName;
            }
        });
        //获取表单
        if (!!keyValue) {
            $.SetForm({
                url: "../../ResourceManage/RS_Product/GetFormJson",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#form1").SetWebControls(data);                   
                }
            });
        }

    }
    //保存表单
    function AcceptClick() {
        if (!$('#form1').Validform()) {
            return false;
        }
        var postData = $("#form1").GetWebControls(keyValue);
        $.SaveForm({
            url: "../../ResourceManage/RS_Product/SaveForm?keyValue=" + keyValue,
            param: postData,
            loading: "正在保存数据...",
            success: function () { 
                $.currentIframe().$("#gridTable").trigger("reloadGrid");
                dialogClose()
            }
        })
    }

   

</script>
<div class="ui-layout" id="layout" style="height: 100%; width: 95%;">
    <table class="form" style="margin:0px auto; margin-top:20px;">
        <tr>
            <td class="formTitle">所属类别<font face="宋体">*</font></td>           
            <td class="formValue" colspan="7"><div id="Type" type="selectTree" class="ui-select" isvalid="yes" checkexpession="NotNull"></div></td>        
        </tr>
        <tr>
            <td class="formTitle">物品名称<font face="宋体">*</font></td>
            <td class="formValue" colspan="3"><input id="Name" class="form-control" isvalid="yes" checkexpession="NotNull" type="text" /></td>
            <td class="formTitle">物品编号<font face="宋体">*</font></td>
            <td class="formValue" colspan="3"><input id="Code" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /></td>
        </tr>
        <tr>
            <td class="formTitle">规格型号<font face="宋体">*</font></td>
            <td class="formValue" colspan="3"><input id="ModelNo" class="form-control" isvalid="yes" checkexpession="NotNull" type="text" /></td>
            <td class="formTitle">品牌<font face="宋体">*</font></td>
            <td class="formValue" colspan="3"><input id="Brand" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /></td>
         </tr>
        <tr>
            <td class="formTitle">计量单位<font face="宋体">*</font></td>
            <td class="formValue" colspan="3">
                <div id="Unit" type="selectTree" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
            </td>
            <td class="formTitle">是否有效 </td>
            <td class="formValue" colspan="3">
                <div class="checkbox">
                    <label>
                        <input id="EnabledMark" type="checkbox" checked="checked" />
                        有效
                    </label>
                </div>
            </td>
        </tr>
        
        @*<tr>
            <td class="formTitle">最低库存量</td>
            <td class="formValue" colspan="3"><input id="MinVolume" type="number" value="0" class="form-control" /></td>
            <td class="formTitle">最高库存量</td>
            <td class="formValue" colspan="3"><input id="MaxVolume" type="number" value="9999" class="form-control" /></td>
        </tr>*@
         
        <tr>   
            @*<td class="formTitle">所属预算科目<font face="宋体">*</font></td>
                <td class="formValue" colspan="7">
                    <div id="BudgetItemId" type="selectTree" class="ui-select"></div>
                </td>*@
        </tr>
        <tr>
            <td class="formTitle">备注</td>
            <td class="formValue" colspan="7"><textarea id="Description" class="form-control" style="height: 70px;"></textarea></td>
        </tr>
    </table>
</div>


